//
//  WDAdCell.m
//  WeiDianGuanJia
//
//  Created by 谢英泽 on 2017/4/9.
//  Copyright © 2017年 谢英泽. All rights reserved.
//

#import "CustomAdCell.h"


@interface CustomAdCell ()
@property (nonatomic, strong) UIView *mainView;
@end

@implementation CustomAdCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = kCOLOR_white;
        [self initSubView];
    }
    return self;
}

#pragma mark - 内部方法

- (void)initSubView {
    [self addSubview:self.mainView];
    [self.mainView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(@0);
    }];
}

#pragma mark - 点击事件

- (void)setSelected:(BOOL)selected {
    [super setSelected:selected];
    if (selected) {
        //选中时
    }else{
        //非选中
    }
    self.backgroundColor = kCOLOR_white;
}

#pragma mark - 外部方法

#pragma mark - Setter && Getter

- (UIView *)mainView {
    if (!_mainView) {
        _mainView = [UIView new];
        
        BaseImageView *adImageView = [BaseImageView new];
        adImageView.imageName = @"unity_placeholderImage";
        self.adImageView = adImageView;
        [_mainView addSubview:adImageView];
        [adImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.edges.equalTo(@0);
        }];
        
        BaseLabel *adTitleLabel = [BaseLabel new];
        adTitleLabel.backgroundColor = kCOLOR_clear;
        [adTitleLabel setViewShadow:kCOLOR_white offset:CGSizeMake(0, 0) radius:kUI_ShawRadius];
        [adTitleLabel setLabelStyle:@"今日活动" textColor:kCOLOR_white textFont:kFONT_mainFont(30) texrAlignment:NSTextAlignmentLeft];
        self.adTitleLabel = adTitleLabel;
        [_mainView addSubview:adTitleLabel];
        [adTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(@20);
            make.top.equalTo(@10);
            make.height.equalTo(@30);
        }];
    }
    return _mainView;
}

@end
